package org.apix.commands.command;

import org.apix.Apix;
import org.apix.commands.BaseCommand;
import org.apix.configuration.PlayerStorageData;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

public class SetWarp extends BaseCommand {
	
	ChatColor white = ChatColor.WHITE;
	ChatColor red = ChatColor.RED;
	
	@Override
	public boolean execute(Player p, org.bukkit.command.Command command, String[] args){
		if(!isEnabled()) {
			return false;
		}
		
		if(!this.defaultCommandChecks(p)) {
			return true;
		}
		
		if(args.length > 0) {
			PlayerStorageData.getInstance(p).setWarp(args[0]);
			p.sendMessage(white + "Your warp " + red + args[0] + white + " has been set.");
		}
		else {
			p.sendMessage("Usage:");
			p.sendMessage("  /setwarp <warpname>");
		}
		
		
		return true;
	}
}